package com.xiaow.android.ebook.app.database;

import java.util.List;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.xiaow.android.ebook.app.model.MenuPage;
import com.xiaow.android.ebook.app.util.DBUtils;

public class MenuPageDB {
	DBConnection dbconn;
	SQLiteDatabase db;

	public MenuPageDB(Context con) {
		dbconn = new DBConnection(con);
		db = dbconn.getWritableDatabase();
	}

	public void update(ContentValues values, String whereClause,
			String[] whereArgs) {
		db.update(DBConstant.MENU_PAGE, values, whereClause, whereArgs);
	}

	public List<MenuPage> query(String novelName) {
		Cursor cursor = db.query(DBConstant.MENU_PAGE,
				DBConstant.MenuPage.FROM, DBConstant.MenuPage.name + " = ?",
				new String[] { novelName }, null, null, null);
		List<MenuPage> list = DBUtils.getResult(cursor, MenuPage.class);
		return list;
	}
}
